using System.Linq;
using HQLAddin.Highlighting.Classificators;
using HQLAddin.Highlighting.Formatters;
using Microsoft.VisualStudio.Text.Classification;
using Moq;
using NUnit.Framework;
using SharpTestsEx;

namespace HQLAddin.Tests.Highlighting
{
	[TestFixture]
	public class StringClassifierTest
	{
		[Test]
		public void ShouldWorkForSimpleString()
		{
			var stringClassifier = new StringClassifier(new Mock<IClassificationTypeRegistryService>().Object);
			var regex = stringClassifier.Regexs.First();
			regex.Matches("where a = 'asalala'")
				.Satisfy(m => m.Count == 1 && m[0].Value == "'asalala'");

		}

		[Test]
		public void WhenStringsHasNotEndThenMatchToTheEnd()
		{
			var stringClassifier = new StringClassifier(new Mock<IClassificationTypeRegistryService>().Object);
			var regex = stringClassifier.Regexs.First();
			regex.Matches("where a = 'asalala")
				.Satisfy(m => m.Count == 1 && m[0].Value == "'asalala");

		}

		[Test]
		public void FormatterNameShouldBeEqualToStringFormatterName()
		{
			var stringClassifier = new StringClassifier(new Mock<IClassificationTypeRegistryService>().Object);
			stringClassifier.FormatterName.Should().Be.EqualTo(StringFormat.Name);
		}
	}
}